import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/login'
  },
  {
    path: '/login',
    component:() => import ('@/views/login/Login.vue')
  },
  //首页放入模板
  {
    path: '/index',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/index' , component:()=>import('@/views/index/Index.vue')
      }
    ]
  },
  //商品页放入模板页
  {
    path: '/goods',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/goods/add' , component:()=>import('@/views/goods/GoodsAdd.vue')
      },
      {
        path:'/goods' , component:()=>import('@/views/goods/GoodsList.vue')
      },
      {
        path:'/goods/sort' , component:()=>import('@/views/goods/GoodsSort.vue')
      }
    ]
  },
  //订单页放入模板页
  {
    path: '/account',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/account' , component:()=>import('@/views/account/Account.vue')
      }
    ]
  },
  //账户页放入模板页
  {
    path: '/person',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/person/add' , component:()=>import('@/views/person/PersonAdd.vue')
      },
      {
        path:'/person' , component:()=>import('@/views/person/PersonList.vue')
      },
      {
        path:'/person/password' , component:()=>import('@/views/person/PersonPassword.vue')
      }
    ]
  },
  //店铺页面放入模板也
  {
    path: '/shop',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/shop' , component:()=>import('@/views/shop/Shop.vue')
      }
    ]
  },
  //统计页面放入模板页
  {
    path: '/stat',
    component: () => import('@/views/index/Layout.vue'),
    children: [
      {
        path:'/stat' , component:()=>import('@/views/stat/StatAccount.vue')
      },
      {
        path:'/stat/goods' , component:()=>import('@/views/stat/StatGoods.vue')
      }
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
